
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace POSSystem.DAL
{
	public abstract class _BranchRole : SqlClientEntity
	{
		public _BranchRole()
		{
			this.QuerySource = "BranchRole";
			this.MappingName = "BranchRole";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_BranchRoleLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int BranchID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.BranchID, BranchID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_BranchRoleLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter Products
			{
				get
				{
					return new SqlParameter("@Products", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Sales
			{
				get
				{
					return new SqlParameter("@Sales", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Purchase
			{
				get
				{
					return new SqlParameter("@Purchase", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Customers
			{
				get
				{
					return new SqlParameter("@Customers", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Suppliers
			{
				get
				{
					return new SqlParameter("@Suppliers", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Repair
			{
				get
				{
					return new SqlParameter("@Repair", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Report
			{
				get
				{
					return new SqlParameter("@Report", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Admin
			{
				get
				{
					return new SqlParameter("@Admin", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter LastModifiedDate
			{
				get
				{
					return new SqlParameter("@LastModifiedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter LastModifiedByUser
			{
				get
				{
					return new SqlParameter("@LastModifiedByUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter Contracts
			{
				get
				{
					return new SqlParameter("@Contracts", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter BranchID
			{
				get
				{
					return new SqlParameter("@BranchID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter SystemAdmin
			{
				get
				{
					return new SqlParameter("@SystemAdmin", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter EditSales
			{
				get
				{
					return new SqlParameter("@EditSales", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Expense
			{
				get
				{
					return new SqlParameter("@Expense", SqlDbType.Bit, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string Products = "Products";
            public const string Sales = "Sales";
            public const string Purchase = "Purchase";
            public const string Customers = "Customers";
            public const string Suppliers = "Suppliers";
            public const string Repair = "Repair";
            public const string Report = "Report";
            public const string Admin = "Admin";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string Contracts = "Contracts";
            public const string BranchID = "BranchID";
            public const string SystemAdmin = "SystemAdmin";
            public const string EditSales = "EditSales";
            public const string Expense = "Expense";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[Products] = _BranchRole.PropertyNames.Products;
					ht[Sales] = _BranchRole.PropertyNames.Sales;
					ht[Purchase] = _BranchRole.PropertyNames.Purchase;
					ht[Customers] = _BranchRole.PropertyNames.Customers;
					ht[Suppliers] = _BranchRole.PropertyNames.Suppliers;
					ht[Repair] = _BranchRole.PropertyNames.Repair;
					ht[Report] = _BranchRole.PropertyNames.Report;
					ht[Admin] = _BranchRole.PropertyNames.Admin;
					ht[LastModifiedDate] = _BranchRole.PropertyNames.LastModifiedDate;
					ht[LastModifiedByUser] = _BranchRole.PropertyNames.LastModifiedByUser;
					ht[Contracts] = _BranchRole.PropertyNames.Contracts;
					ht[BranchID] = _BranchRole.PropertyNames.BranchID;
					ht[SystemAdmin] = _BranchRole.PropertyNames.SystemAdmin;
					ht[EditSales] = _BranchRole.PropertyNames.EditSales;
					ht[Expense] = _BranchRole.PropertyNames.Expense;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string Products = "Products";
            public const string Sales = "Sales";
            public const string Purchase = "Purchase";
            public const string Customers = "Customers";
            public const string Suppliers = "Suppliers";
            public const string Repair = "Repair";
            public const string Report = "Report";
            public const string Admin = "Admin";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string Contracts = "Contracts";
            public const string BranchID = "BranchID";
            public const string SystemAdmin = "SystemAdmin";
            public const string EditSales = "EditSales";
            public const string Expense = "Expense";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[Products] = _BranchRole.ColumnNames.Products;
					ht[Sales] = _BranchRole.ColumnNames.Sales;
					ht[Purchase] = _BranchRole.ColumnNames.Purchase;
					ht[Customers] = _BranchRole.ColumnNames.Customers;
					ht[Suppliers] = _BranchRole.ColumnNames.Suppliers;
					ht[Repair] = _BranchRole.ColumnNames.Repair;
					ht[Report] = _BranchRole.ColumnNames.Report;
					ht[Admin] = _BranchRole.ColumnNames.Admin;
					ht[LastModifiedDate] = _BranchRole.ColumnNames.LastModifiedDate;
					ht[LastModifiedByUser] = _BranchRole.ColumnNames.LastModifiedByUser;
					ht[Contracts] = _BranchRole.ColumnNames.Contracts;
					ht[BranchID] = _BranchRole.ColumnNames.BranchID;
					ht[SystemAdmin] = _BranchRole.ColumnNames.SystemAdmin;
					ht[EditSales] = _BranchRole.ColumnNames.EditSales;
					ht[Expense] = _BranchRole.ColumnNames.Expense;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string Products = "s_Products";
            public const string Sales = "s_Sales";
            public const string Purchase = "s_Purchase";
            public const string Customers = "s_Customers";
            public const string Suppliers = "s_Suppliers";
            public const string Repair = "s_Repair";
            public const string Report = "s_Report";
            public const string Admin = "s_Admin";
            public const string LastModifiedDate = "s_LastModifiedDate";
            public const string LastModifiedByUser = "s_LastModifiedByUser";
            public const string Contracts = "s_Contracts";
            public const string BranchID = "s_BranchID";
            public const string SystemAdmin = "s_SystemAdmin";
            public const string EditSales = "s_EditSales";
            public const string Expense = "s_Expense";

		}
		#endregion		
		
		#region Properties
	
		public virtual bool Products
	    {
			get
	        {
				return base.Getbool(ColumnNames.Products);
			}
			set
	        {
				base.Setbool(ColumnNames.Products, value);
			}
		}

		public virtual bool Sales
	    {
			get
	        {
				return base.Getbool(ColumnNames.Sales);
			}
			set
	        {
				base.Setbool(ColumnNames.Sales, value);
			}
		}

		public virtual bool Purchase
	    {
			get
	        {
				return base.Getbool(ColumnNames.Purchase);
			}
			set
	        {
				base.Setbool(ColumnNames.Purchase, value);
			}
		}

		public virtual bool Customers
	    {
			get
	        {
				return base.Getbool(ColumnNames.Customers);
			}
			set
	        {
				base.Setbool(ColumnNames.Customers, value);
			}
		}

		public virtual bool Suppliers
	    {
			get
	        {
				return base.Getbool(ColumnNames.Suppliers);
			}
			set
	        {
				base.Setbool(ColumnNames.Suppliers, value);
			}
		}

		public virtual bool Repair
	    {
			get
	        {
				return base.Getbool(ColumnNames.Repair);
			}
			set
	        {
				base.Setbool(ColumnNames.Repair, value);
			}
		}

		public virtual bool Report
	    {
			get
	        {
				return base.Getbool(ColumnNames.Report);
			}
			set
	        {
				base.Setbool(ColumnNames.Report, value);
			}
		}

		public virtual bool Admin
	    {
			get
	        {
				return base.Getbool(ColumnNames.Admin);
			}
			set
	        {
				base.Setbool(ColumnNames.Admin, value);
			}
		}

		public virtual DateTime LastModifiedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.LastModifiedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual int LastModifiedByUser
	    {
			get
	        {
				return base.Getint(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				base.Setint(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual bool Contracts
	    {
			get
	        {
				return base.Getbool(ColumnNames.Contracts);
			}
			set
	        {
				base.Setbool(ColumnNames.Contracts, value);
			}
		}

		public virtual int BranchID
	    {
			get
	        {
				return base.Getint(ColumnNames.BranchID);
			}
			set
	        {
				base.Setint(ColumnNames.BranchID, value);
			}
		}

		public virtual bool SystemAdmin
	    {
			get
	        {
				return base.Getbool(ColumnNames.SystemAdmin);
			}
			set
	        {
				base.Setbool(ColumnNames.SystemAdmin, value);
			}
		}

		public virtual bool EditSales
	    {
			get
	        {
				return base.Getbool(ColumnNames.EditSales);
			}
			set
	        {
				base.Setbool(ColumnNames.EditSales, value);
			}
		}

		public virtual bool Expense
	    {
			get
	        {
				return base.Getbool(ColumnNames.Expense);
			}
			set
	        {
				base.Setbool(ColumnNames.Expense, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_Products
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Products) ? string.Empty : base.GetboolAsString(ColumnNames.Products);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Products);
				else
					this.Products = base.SetboolAsString(ColumnNames.Products, value);
			}
		}

		public virtual string s_Sales
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Sales) ? string.Empty : base.GetboolAsString(ColumnNames.Sales);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Sales);
				else
					this.Sales = base.SetboolAsString(ColumnNames.Sales, value);
			}
		}

		public virtual string s_Purchase
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Purchase) ? string.Empty : base.GetboolAsString(ColumnNames.Purchase);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Purchase);
				else
					this.Purchase = base.SetboolAsString(ColumnNames.Purchase, value);
			}
		}

		public virtual string s_Customers
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Customers) ? string.Empty : base.GetboolAsString(ColumnNames.Customers);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Customers);
				else
					this.Customers = base.SetboolAsString(ColumnNames.Customers, value);
			}
		}

		public virtual string s_Suppliers
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Suppliers) ? string.Empty : base.GetboolAsString(ColumnNames.Suppliers);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Suppliers);
				else
					this.Suppliers = base.SetboolAsString(ColumnNames.Suppliers, value);
			}
		}

		public virtual string s_Repair
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Repair) ? string.Empty : base.GetboolAsString(ColumnNames.Repair);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Repair);
				else
					this.Repair = base.SetboolAsString(ColumnNames.Repair, value);
			}
		}

		public virtual string s_Report
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Report) ? string.Empty : base.GetboolAsString(ColumnNames.Report);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Report);
				else
					this.Report = base.SetboolAsString(ColumnNames.Report, value);
			}
		}

		public virtual string s_Admin
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Admin) ? string.Empty : base.GetboolAsString(ColumnNames.Admin);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Admin);
				else
					this.Admin = base.SetboolAsString(ColumnNames.Admin, value);
			}
		}

		public virtual string s_LastModifiedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.LastModifiedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedDate);
				else
					this.LastModifiedDate = base.SetDateTimeAsString(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual string s_LastModifiedByUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedByUser) ? string.Empty : base.GetintAsString(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedByUser);
				else
					this.LastModifiedByUser = base.SetintAsString(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual string s_Contracts
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Contracts) ? string.Empty : base.GetboolAsString(ColumnNames.Contracts);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Contracts);
				else
					this.Contracts = base.SetboolAsString(ColumnNames.Contracts, value);
			}
		}

		public virtual string s_BranchID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BranchID) ? string.Empty : base.GetintAsString(ColumnNames.BranchID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BranchID);
				else
					this.BranchID = base.SetintAsString(ColumnNames.BranchID, value);
			}
		}

		public virtual string s_SystemAdmin
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SystemAdmin) ? string.Empty : base.GetboolAsString(ColumnNames.SystemAdmin);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SystemAdmin);
				else
					this.SystemAdmin = base.SetboolAsString(ColumnNames.SystemAdmin, value);
			}
		}

		public virtual string s_EditSales
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.EditSales) ? string.Empty : base.GetboolAsString(ColumnNames.EditSales);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.EditSales);
				else
					this.EditSales = base.SetboolAsString(ColumnNames.EditSales, value);
			}
		}

		public virtual string s_Expense
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Expense) ? string.Empty : base.GetboolAsString(ColumnNames.Expense);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Expense);
				else
					this.Expense = base.SetboolAsString(ColumnNames.Expense, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter Products
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Products, Parameters.Products);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Sales
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Sales, Parameters.Sales);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Purchase
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Purchase, Parameters.Purchase);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Customers
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Customers, Parameters.Customers);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Suppliers
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Suppliers, Parameters.Suppliers);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Repair
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Repair, Parameters.Repair);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Report
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Report, Parameters.Report);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Admin
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Admin, Parameters.Admin);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedByUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Contracts
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Contracts, Parameters.Contracts);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BranchID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SystemAdmin
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SystemAdmin, Parameters.SystemAdmin);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter EditSales
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.EditSales, Parameters.EditSales);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Expense
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Expense, Parameters.Expense);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter Products
		    {
				get
		        {
					if(_Products_W == null)
	        	    {
						_Products_W = TearOff.Products;
					}
					return _Products_W;
				}
			}

			public WhereParameter Sales
		    {
				get
		        {
					if(_Sales_W == null)
	        	    {
						_Sales_W = TearOff.Sales;
					}
					return _Sales_W;
				}
			}

			public WhereParameter Purchase
		    {
				get
		        {
					if(_Purchase_W == null)
	        	    {
						_Purchase_W = TearOff.Purchase;
					}
					return _Purchase_W;
				}
			}

			public WhereParameter Customers
		    {
				get
		        {
					if(_Customers_W == null)
	        	    {
						_Customers_W = TearOff.Customers;
					}
					return _Customers_W;
				}
			}

			public WhereParameter Suppliers
		    {
				get
		        {
					if(_Suppliers_W == null)
	        	    {
						_Suppliers_W = TearOff.Suppliers;
					}
					return _Suppliers_W;
				}
			}

			public WhereParameter Repair
		    {
				get
		        {
					if(_Repair_W == null)
	        	    {
						_Repair_W = TearOff.Repair;
					}
					return _Repair_W;
				}
			}

			public WhereParameter Report
		    {
				get
		        {
					if(_Report_W == null)
	        	    {
						_Report_W = TearOff.Report;
					}
					return _Report_W;
				}
			}

			public WhereParameter Admin
		    {
				get
		        {
					if(_Admin_W == null)
	        	    {
						_Admin_W = TearOff.Admin;
					}
					return _Admin_W;
				}
			}

			public WhereParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public WhereParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public WhereParameter Contracts
		    {
				get
		        {
					if(_Contracts_W == null)
	        	    {
						_Contracts_W = TearOff.Contracts;
					}
					return _Contracts_W;
				}
			}

			public WhereParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			public WhereParameter SystemAdmin
		    {
				get
		        {
					if(_SystemAdmin_W == null)
	        	    {
						_SystemAdmin_W = TearOff.SystemAdmin;
					}
					return _SystemAdmin_W;
				}
			}

			public WhereParameter EditSales
		    {
				get
		        {
					if(_EditSales_W == null)
	        	    {
						_EditSales_W = TearOff.EditSales;
					}
					return _EditSales_W;
				}
			}

			public WhereParameter Expense
		    {
				get
		        {
					if(_Expense_W == null)
	        	    {
						_Expense_W = TearOff.Expense;
					}
					return _Expense_W;
				}
			}

			private WhereParameter _Products_W = null;
			private WhereParameter _Sales_W = null;
			private WhereParameter _Purchase_W = null;
			private WhereParameter _Customers_W = null;
			private WhereParameter _Suppliers_W = null;
			private WhereParameter _Repair_W = null;
			private WhereParameter _Report_W = null;
			private WhereParameter _Admin_W = null;
			private WhereParameter _LastModifiedDate_W = null;
			private WhereParameter _LastModifiedByUser_W = null;
			private WhereParameter _Contracts_W = null;
			private WhereParameter _BranchID_W = null;
			private WhereParameter _SystemAdmin_W = null;
			private WhereParameter _EditSales_W = null;
			private WhereParameter _Expense_W = null;

			public void WhereClauseReset()
			{
				_Products_W = null;
				_Sales_W = null;
				_Purchase_W = null;
				_Customers_W = null;
				_Suppliers_W = null;
				_Repair_W = null;
				_Report_W = null;
				_Admin_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_Contracts_W = null;
				_BranchID_W = null;
				_SystemAdmin_W = null;
				_EditSales_W = null;
				_Expense_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter Products
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Products, Parameters.Products);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Sales
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Sales, Parameters.Sales);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Purchase
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Purchase, Parameters.Purchase);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Customers
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Customers, Parameters.Customers);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Suppliers
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Suppliers, Parameters.Suppliers);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Repair
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Repair, Parameters.Repair);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Report
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Report, Parameters.Report);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Admin
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Admin, Parameters.Admin);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedByUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Contracts
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Contracts, Parameters.Contracts);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BranchID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SystemAdmin
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SystemAdmin, Parameters.SystemAdmin);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter EditSales
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.EditSales, Parameters.EditSales);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Expense
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Expense, Parameters.Expense);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter Products
		    {
				get
		        {
					if(_Products_W == null)
	        	    {
						_Products_W = TearOff.Products;
					}
					return _Products_W;
				}
			}

			public AggregateParameter Sales
		    {
				get
		        {
					if(_Sales_W == null)
	        	    {
						_Sales_W = TearOff.Sales;
					}
					return _Sales_W;
				}
			}

			public AggregateParameter Purchase
		    {
				get
		        {
					if(_Purchase_W == null)
	        	    {
						_Purchase_W = TearOff.Purchase;
					}
					return _Purchase_W;
				}
			}

			public AggregateParameter Customers
		    {
				get
		        {
					if(_Customers_W == null)
	        	    {
						_Customers_W = TearOff.Customers;
					}
					return _Customers_W;
				}
			}

			public AggregateParameter Suppliers
		    {
				get
		        {
					if(_Suppliers_W == null)
	        	    {
						_Suppliers_W = TearOff.Suppliers;
					}
					return _Suppliers_W;
				}
			}

			public AggregateParameter Repair
		    {
				get
		        {
					if(_Repair_W == null)
	        	    {
						_Repair_W = TearOff.Repair;
					}
					return _Repair_W;
				}
			}

			public AggregateParameter Report
		    {
				get
		        {
					if(_Report_W == null)
	        	    {
						_Report_W = TearOff.Report;
					}
					return _Report_W;
				}
			}

			public AggregateParameter Admin
		    {
				get
		        {
					if(_Admin_W == null)
	        	    {
						_Admin_W = TearOff.Admin;
					}
					return _Admin_W;
				}
			}

			public AggregateParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public AggregateParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public AggregateParameter Contracts
		    {
				get
		        {
					if(_Contracts_W == null)
	        	    {
						_Contracts_W = TearOff.Contracts;
					}
					return _Contracts_W;
				}
			}

			public AggregateParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			public AggregateParameter SystemAdmin
		    {
				get
		        {
					if(_SystemAdmin_W == null)
	        	    {
						_SystemAdmin_W = TearOff.SystemAdmin;
					}
					return _SystemAdmin_W;
				}
			}

			public AggregateParameter EditSales
		    {
				get
		        {
					if(_EditSales_W == null)
	        	    {
						_EditSales_W = TearOff.EditSales;
					}
					return _EditSales_W;
				}
			}

			public AggregateParameter Expense
		    {
				get
		        {
					if(_Expense_W == null)
	        	    {
						_Expense_W = TearOff.Expense;
					}
					return _Expense_W;
				}
			}

			private AggregateParameter _Products_W = null;
			private AggregateParameter _Sales_W = null;
			private AggregateParameter _Purchase_W = null;
			private AggregateParameter _Customers_W = null;
			private AggregateParameter _Suppliers_W = null;
			private AggregateParameter _Repair_W = null;
			private AggregateParameter _Report_W = null;
			private AggregateParameter _Admin_W = null;
			private AggregateParameter _LastModifiedDate_W = null;
			private AggregateParameter _LastModifiedByUser_W = null;
			private AggregateParameter _Contracts_W = null;
			private AggregateParameter _BranchID_W = null;
			private AggregateParameter _SystemAdmin_W = null;
			private AggregateParameter _EditSales_W = null;
			private AggregateParameter _Expense_W = null;

			public void AggregateClauseReset()
			{
				_Products_W = null;
				_Sales_W = null;
				_Purchase_W = null;
				_Customers_W = null;
				_Suppliers_W = null;
				_Repair_W = null;
				_Report_W = null;
				_Admin_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_Contracts_W = null;
				_BranchID_W = null;
				_SystemAdmin_W = null;
				_EditSales_W = null;
				_Expense_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_BranchRoleInsert]";
	
			CreateParameters(cmd);
			    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_BranchRoleUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_BranchRoleDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.BranchID);
			p.SourceColumn = ColumnNames.BranchID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.Products);
			p.SourceColumn = ColumnNames.Products;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Sales);
			p.SourceColumn = ColumnNames.Sales;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Purchase);
			p.SourceColumn = ColumnNames.Purchase;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Customers);
			p.SourceColumn = ColumnNames.Customers;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Suppliers);
			p.SourceColumn = ColumnNames.Suppliers;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Repair);
			p.SourceColumn = ColumnNames.Repair;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Report);
			p.SourceColumn = ColumnNames.Report;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Admin);
			p.SourceColumn = ColumnNames.Admin;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedDate);
			p.SourceColumn = ColumnNames.LastModifiedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedByUser);
			p.SourceColumn = ColumnNames.LastModifiedByUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Contracts);
			p.SourceColumn = ColumnNames.Contracts;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BranchID);
			p.SourceColumn = ColumnNames.BranchID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SystemAdmin);
			p.SourceColumn = ColumnNames.SystemAdmin;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.EditSales);
			p.SourceColumn = ColumnNames.EditSales;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Expense);
			p.SourceColumn = ColumnNames.Expense;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
